<template>
  <com-page class="com-p-md">
    <u-navbar placeholder
              leftIcon=""
              :title="$t('tabbar.home')" />
    <view class="com-button com-color-primary"
          @click="changeTheme"> 切换主题 </view>
    <view class="com-button com-color-primary"
          @click="onChangeLanguage"> 切换语言 </view>
  </com-page>
</template>

<script>
import { mapActions } from 'vuex'
import { changeLanguage } from '@/i18n'
export default {
  name: 'App-Index',
  data() {
    return {}
  },

  async onLoad() {
    this.$api.user.login()
  },
  methods: {
    ...mapActions(['changeTheme']),
    onChangeLanguage() {
      changeLanguage(uni.getStorageSync('language') == 'en' ? 'zh' : 'en')
    },
  },
}
</script>

<style lang="scss" scoped></style>
